let { windowWidth, windowHeight, screenWidth, screenHeight, devicePixelRatio, model } = wx.getSystemInfoSync()

model = String(model).toLowerCase()
const iPad = model.indexOf("ipad") !== -1

function isLandscape () {
  if (iPad && GameGlobal.screencanvas) {
    console.log('0 GameGlobal.screencanvas', GameGlobal.screencanvas.width, GameGlobal.screencanvas.height)
    return GameGlobal.screencanvas.width > GameGlobal.screencanvas.height
  }
  return windowWidth > windowHeight;
}

const landscape = isLandscape();

let _ww = windowWidth;
let _wh = windowHeight;
let _sw = screenWidth;
let _sh = screenHeight;
if (landscape) {
  windowWidth = Math.max(_ww, _wh)
  windowHeight = Math.min(_ww, _wh)
  screenWidth = Math.max(_sw, _sh)
  screenHeight = Math.min(_sw, _sh)
} else {
  windowWidth = Math.min(_ww, _wh)
  windowHeight = Math.max(_ww, _wh)
  screenWidth = Math.min(_sw, _sh)
  screenHeight = Math.max(_sw, _sh)
}

export const innerWidth = windowWidth
export const innerHeight = windowHeight
export { devicePixelRatio }
export const screen = {
  width: screenWidth,
  height: screenHeight,
  availWidth: innerWidth,
  availHeight: innerHeight,
  availLeft: 0,
  availTop: 0,
}

export const performance = {
  now: Date.now
};

export const ontouchstart = null;
export const ontouchmove = null;
export const ontouchend = null;
